<template>
  <div class="edit">
    <div class="breadcrumb">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <el-icon><apple /></el-icon>
          文件处理
        </el-breadcrumb-item>
        <el-breadcrumb-item>文件编辑器</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <div class="content">
      <QuillEditor v-model="content" :options="quilleditor"> </QuillEditor>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, toRefs } from "vue";
import { QuillEditor } from "@vueup/vue-quill";
import "@vueup/vue-quill/dist/vue-quill.bubble.css";
import "@vueup/vue-quill/dist/vue-quill.snow.css";

let content = ref("123123");
let data =reactive({
  toolbarOptions : [
  ['bold', 'italic', 'underline', 'strike'],        // toggled buttons
  ['blockquote', 'code-block'],

  [{ 'header': 1 }, { 'header': 2 }],               // custom button values
  [{ 'list': 'ordered'}, { 'list': 'bullet' }],
  [{ 'script': 'sub'}, { 'script': 'super' }],      // superscript/subscript
  [{ 'indent': '-1'}, { 'indent': '+1' }],          // outdent/indent
  [{ 'direction': 'rtl' }],                         // text direction

  [{ 'size': ['small', false, 'large', 'huge'] }],  // custom dropdown
  [{ 'header': [1, 2, 3, 4, 5, 6, false] }],

  [{ 'color': [] }, { 'background': [] }],          // dropdown with defaults from theme
  [{ 'font': [] }],
  [{ 'align': [] }],

  ['clean']                                         // remove formatting button
]})

let {toolbarOptions} =toRefs(data)
let options = reactive({
 quilleditor: {
    modules: {
      toolbar: toolbarOptions
    },
    placeholder:'请输入内容',
    readOnly: false,
    theme: "bubble",
  },
});
let { quilleditor } = toRefs(options);
</script>

<style scoped>
.el-icon {
  vertical-align: top;
  margin: 0 3px;
}
.content {
  width: 90%;
  background-color: #fff;
  height: 500px;
  margin: 60px auto;
}
</style>